﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Data.DBModels;

namespace Data.MyDbContext
{
    public class WebStudioDbContext:DbContext
    {
        public WebStudioDbContext()
            //: base()
            : base("WebStudio_ConnectionString")
        {
        }

        public DbSet<Website> Websites { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Category> Categories { get; set; }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

           base.OnModelCreating(modelBuilder);

          // modelBuilder.Entity<Website>()
          //     .HasRequired(t => t.CreatedBy)
          //     .WithMany()
          //     .HasForeignKey(f => f.CreatedBy_Id)
          //     .WillCascadeOnDelete(true);



          // modelBuilder.Entity<Category>()
          //.HasRequired(t => t.CreatedBy)
          //.WithMany(m => m.Categories)
          //.HasForeignKey(f => f.CreatedBy_Id)
          //.WillCascadeOnDelete(true);



        }
    }
}
